package app.server.project.main.service.db.dao.cfg;

import app.server.project.main.service.db.entity.cfg.LvCfgEntity;
import app.server.project.main.service.db.mapper.cfg.LvCfgMapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.PostConstruct;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class LvCfgDao extends ServiceImpl<LvCfgMapper, LvCfgEntity> {

    private List<LvCfgEntity> cfgEntityList = null;


    public List<LvCfgEntity> getAll() {
        return cfgEntityList;
    }

    @PostConstruct
    public void init() {
        this.flush();
    }

    public void flush() {
        this.cfgEntityList = this.list(Wrappers.<LvCfgEntity>lambdaQuery().orderByAsc(LvCfgEntity::getLv));
    }
}
